package com.euro.video.phone.services;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.euro.video.phone.dao.ArticleDao;
import com.euro.video.phone.entities.Article;
import com.euro.video.phone.utils.EvpEnum;

@Service
public class ArticleService {
	@Autowired
	private ArticleDao articleDao;
	
	public Article creer(Article article) throws Exception {
		return articleDao.creerArticle(article);
	}
	
	public Article lire(long idArticle) throws Exception {
		return articleDao.lireArticle(idArticle);
	}
	
	public Article lire(String nom) throws Exception {
		return articleDao.lireArticle(nom);
	}
	
	public Article modifier(Article article) throws Exception {
		return articleDao.modifierArticle(article);
	}
	
	public boolean supprimer(Article article) throws Exception {
		return articleDao.supprimerArticle(article);
	}
	
	public List<Article> listArticleEnPromo() throws Exception {
		return articleDao.listArticlesEnPromo();
	}
	
	public List<Article> listArticleParType(EvpEnum type) throws Exception {
		return articleDao.listArticlesParType(type);
	}
	
	public byte[] getImage(String nom) throws Exception {
		return articleDao.retrouverImage(nom);
	}
	
	public List<Article> articlesRecents() throws Exception {
		return articleDao.listArticlesRecents();
	}
}
